﻿using DotNetStar.TheKing.Infrastructure;
using SDDP;
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace DotNetStar.TheKing.Domain
{
    /// <summary>
    /// 用户操作记录
    /// </summary>
    /// <seealso cref="SDDP.IEntity{System.Guid}" />
    [Table("UserOperationHistories")]
    public class UserOperationHistory : IEntity<Guid>
    {
        [Key,DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public Guid Id { get; set; } = Guid.NewGuid();

        /// <summary>
        /// 操作类型。
        /// </summary>
        public UserOperations Type { get; set; }

        /// <summary>
        /// 操作的对象Id。由 <see cref="Type"/> 决定逻辑。
        /// </summary>
        [StringLength(128),Required]
        public string ObjectId { get; set; }

        public long UserId { get; set; }

        public DateTime CreatedTime { get; internal set; } = DateTime.Now;

        /// <summary>
        /// 备注
        /// </summary>
        [StringLength(500)]
        public string Remark { get; set; }
    }
}
